<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><{$site_title}>管理中心</title>
<{include file="js.html"}>

<{include file="kindeditor.html"}>
<link type="text/css" rel="stylesheet" href="css/validator.css"></link>
<script src="js/formValidator.js" type="text/javascript"></script>
<script src="js/formValidatorRegex.js" type="text/javascript"></script>
<script src="http://api.map.baidu.com/api?v=2.0&ak=mU3RirI2eGqq6gfy98j2tT9c
" type="text/javascript"></script><!-- 百度地图api -->
<style type="text/css">
  body, html {width: 100%;height: 100%;margin:0;font-family:"微软雅黑";}
  #allmap{width:100%;height:300px;}
  p{margin-left:5px; font-size:14px;}
</style>
<script type="text/javascript">
//获得城市，地区
function getArea(type,father,child,county,circle){
  var fatherid=father.val();
  $.post(
    'ajax.php?action=getArea',
    {type:type,fatherid:fatherid},
    function(data){
      if(county!=''){
        if(data.error=='0' && type=='city'){
          county.html('<option value="">请选择</option>');
          circle.html('<option value="">请选择</option>');
        }
        if(data.error!='0'){
          county.html('<option value="">请选择</option>');
          circle.html('<option value="">请选择</option>');
        }

      }
      child.html(data.child);
    },'json'
  )
}

$(function(){
  
  //商品-》货品
  $('select:[name="class_top"]').change(function(){
    var id=$(this).val();
    $.post(
        'ajax.php?action=getClass',
        {id:id},
        function(data){
          $('select:[name="class_id"]').html(data);
        }
      )
  })  

  $("#myForm").submit(function(){
    return queding('是否保存设置？',".subCheck");
  })
})
</script>
</head>

<body>
<div class="box">
<div style="background:url(images/mainbj.jpg) repeat-x; line-height:31px; height:31px;">
<table width="262" height="31" border="0" cellpadding="0" cellspacing="0">
<tr><td width="41" align="center">
<img src="images/biao1.jpg" /></td>
<td width="221"><strong>当前位置</strong>：管理员 &gt; 添加服务</td>
</tr></table>
</div>

<{if $id!=''}>
<table class="lefttab" cellpadding="0" cellspacing="0">
<tbody>
<tr><td height="50px" class="xiugai">
<a style="float:left; margin-left:5px;" href="service_add.php?id=<{$id}>"><div class="inp2 inp">基本信息</div></a>
<a style="float:left; margin-left:5px;" href="service_album.php?id=<{$id}>"><div class="inp2">相册信息</div></a>
<a style="float:left; margin-left:5px;" href="service_comment.php?id=<{$id}>"><div class="inp2">用户评论</div></a>
&nbsp;</td>
  </tr>
</tbody></table>
<{/if}>

<form action="" method="post" name="myForm" id="myForm" enctype='multipart/form-data'>
<table class="lefttab" cellpadding="0" cellspacing="0">
<tr><td colspan="3"><div style="height:26px; text-align:left; line-height:26px; background:url(images/xbj1.jpg) repeat-x; border:1px solid #e9f5fa;font-weight:bold;">&nbsp;&nbsp;添加服务</div>
</td></tr>
<tr>
  <td width="100" align="right"><font color="#e47c02">*</font> <strong>服务标题</strong>：</td>
  <td width="310" align="left">&nbsp;<input type="text" name="title"  size="20" class="subCheck" value="<{$row.title}>" /></td>
</tr>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>服务简介</strong>：</td>
  <td align="left">&nbsp;<textarea name="intro" class="subCheck" rows="5" cols="40" ><{$row.intro}></textarea> </td>
</tr>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>logo</strong>：</td>
  <td width="673" align="left">&nbsp;<input type="file" name="logo" /></td>
</tr>
<{if $row.logo!=""}>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>原logo</strong>：</td>
  <td width="673" align="left">&nbsp;<a target="_blank" href="../upload/service/large/<{$row.logo}>"><img src="../upload/service/small/<{$row.logo}>"/></a></td>
</tr>
<{/if}>

<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>分类</strong>：</td>
  <td width="873" align="left">&nbsp;
    <select class="subCheck" name="class_top">
      <option value=''>请选择</option>
      <{foreach item=loop from=$service_class}>
       <option value='<{$loop.id}>' <{if $upid==$loop.id}>selected<{/if}>><{$loop.class_name}></option>
      <{/foreach}>
      }
    </select>
    <select class="subCheck" name="class_id">
      <option value=''>请选择</option>
      <{foreach item=loop from=$list2}>
       <option value='<{$loop.id}>' <{if $row.class_id==$loop.id}>selected<{/if}>><{$loop.class_name}></option>
      <{/foreach}>
    </select>
  </td>
</tr>

<tr>
  <td width="100" align="right"><font color="#e47c02">*</font> <strong>联系人</strong>：</td>
  <td width="310" align="left">&nbsp;<input type="text" name="linkman"  size="20" class="subCheck" value="<{$row.linkman}>" /></td>
</tr>
<tr>
  <td width="100" align="right"><font color="#e47c02">*</font> <strong>联系电话</strong>：</td>
  <td width="310" align="left">&nbsp;<input type="text" name="phone"  size="20" class="subCheck" value="<{$row.phone}>" /></td>
</tr>

<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>二维码</strong>：</td>
  <td width="673" align="left">&nbsp;<input type="file" name="qr_code" /></td>
</tr>
<{if $row.qr_code!=""}>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>原二维码</strong>：</td>
  <td width="673" align="left">&nbsp;<a target="_blank" href="../upload/service/large/<{$row.qr_code}>"><img src="../upload/service/small/<{$row.qr_code}>"/></a></td>
</tr>
<{/if}>

<tr>
  <td width="100" align="right"><font color="#e47c02">*</font> <strong>营业时间</strong>：</td>
  <td width="310" align="left">&nbsp;<input type="text" name="office_hours"  size="20" class="subCheck" value="<{$row.office_hours}>" />&nbsp;</td>
</tr>

 <tr>
  <td align="right"><font color="#e47c02">*</font> <strong>所在城市</strong>：</td>
  <td width="873" align="left">&nbsp;
     <select name="province"  onchange="getArea('city',$('select:[name=province]'),$('select:[name=city]'),$('select:[name=county]'),$('select:[name=circle]'))" class="gz_xgxnry2 subCheck"> 
        <option value="">请选择</option>
        <{foreach item=loop from=$province}>
        <option value="<{$loop.provinceid}>"  <{$loop.selected}>><{$loop.province}></option>
        <{/foreach}>
      </select>
     <select name="city" onChange="getArea('county',$('select:[name=city]'),$('select:[name=county]'),$('select:[name=circle]'))" class="gz_xgxnry2 subCheck">
        <option value="">请选择</option>
        <{foreach item=loop from=$city}>
        <option value="<{$loop.cityid}>" <{$loop.selected}>><{$loop.city}></option>
        <{/foreach}>
    </select>
    <select name="county" onChange="getArea('circle',$('select:[name=county]'),$('select:[name=circle]'),$('select:[name=circle]'))" class="gz_xgxnry2 subCheck">
        <option>请选择</option>
        <{foreach item=loop from=$county}>
        <option value="<{$loop.countyid}>" <{$loop.selected}>><{$loop.county}></option>
        <{/foreach}>
    </select>
  </td>
</tr>

<tr>
  <td width="100" align="right"><font color="#e47c02">*</font> <strong>详细地址</strong>：</td>
  <td width="310" align="left">&nbsp;<input type="text" name="address"  size="20" class="subCheck" value="<{$row.address}>" /></td>
</tr>

<{if $id}>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>审核</strong>：</td>
  <td width="673" align="left">&nbsp;<input type="radio" name="check" value="pass" <{if $row.check=='pass'}>checked<{/if}>/>通过 <input type="radio" name="check" value="refuse" <{if $row.check=='refuse'}>checked<{/if}>/>拒绝 </td>
</tr>
<{/if}>
<input type="hidden" class="" checkMsg="请在地图上标注位置" name="map_x" value="<{$row.map_x}>"/>
<input type="hidden" class="" checkMsg="请在地图上标注位置" name="map_y" value="<{$row.map_y}>"/>
<tr>
  <td width="100" align="right"><font color="#e47c02">*</font> <strong>百度地图</strong>：</td>
  <td width="310" align="left">&nbsp;
          <div id="allmap">
    
          </div>
  </td>
</tr>

<tr><td height="50px" colspan="2">
	<p>&nbsp;</p>
    <p align="left" style="margin-left:100px;">
      &nbsp;&nbsp;<input type="submit" name="submit" value="保存" class="inp"/>
      </p>    <p>&nbsp;</p></td>
  </tr>
</table>
</form>

</div>
<script type="text/javascript"> 
// 百度地图API功能
  var map = new BMap.Map("allmap");   //实例化地图
  
  var myCity = new BMap.LocalCity();    //获得当前城市
  myCity.get(myFun);  
        
  map.centerAndZoom(new BMap.Point(), 11);    //设置地图中心坐标
  map.enableScrollWheelZoom(true);    //鼠标滚轮放大
  //自定义函数（设置地图中心）
  function myFun(result){
    var cityName = result.name;
    map.setCenter(cityName);
  }
  //自定义函数点击标注位置
  function addMarker(point){
    var allover = map.getOverlays();
    for (var i = 0; i < allover.length; i++){
      map.removeOverlay(allover[i]);
    }
      var marker = new BMap.Marker(point);
      map.addOverlay(marker);
  }
  var local = new BMap.LocalSearch(map, {
    renderOptions:{map: map}
  });
  //默认标注
  if('<{$row.map_x}>'!=''){
    var x='<{$row.map_x}>';
    var y='<{$row.map_y}>';
    var points = new BMap.Point(x,y);
    addMarker(points);
  }
  //鼠标点击事件
  map.addEventListener("click",function(e){
    var point = new BMap.Point(e.point.lng ,e.point.lat);
    addMarker(point);
    $("[name=map_x]").val(e.point.lng);
    $("[name=map_y]").val(e.point.lat);
  })
  
  local.search("");
</script> 
</body>
</html>